import type {
  IOptionType,
  IStatusFirstOptionType,
  IColumnsKeysList,
  IChartsLineType,
  IExecuteStatusOptionType,
} from './type';

import {
  IStepsType,
  ITitleType,
  IExecuteStatusType,
  IStatusLastType,
  IStatusFirstType,
  ILogoType,
  IUnitType,
  ISmoothStatusType,
  IBaseValueType,
  ICorrectionType,
  ISourceType,
  IValueType,
  IStoreType,
  IForecastAndSimulateChartsLineType,
  IColumnsKeyType,
  IPriceDiffCurveChartsLineType,
  ISideType,
  IStatusSecondType,
  IUserAndSimulateChartsLineType,
} from './type';
import { iconAi, iconAiNow } from '@/assets/icon/index.js';

export const specialProvinceValue = '14';

export const stepsOptions: IOptionType[] = [
  { label: '策略制定', value: IStepsType.STRATEGY, disabled: false },
  { label: '申报执行', value: IStepsType.DECLARE_TO_PERFORM, disabled: false },
  // { label: '偏差分析', value: IStepsType.DEVIATION_ANALYSIS, disabled: true },
];

export const titleMap: any = {
  [ITitleType.STRATEGIC_BENEFIT_ESTIMATION]: {
    title: '策略效益预估',
    hintText:
      '效益评估模型主要考量调整策略对现货市场收益的影响，含现货超额收益回收，不包含中长期回收（沉没成本）以及双细则考核部分。',
  },
  [ITitleType.DECLARE_PLAN]: {
    title: '申报计划',
  },
  [ITitleType.DECLARE_DETAIL]: {
    title: '申报详情',
  },
  [ITitleType.STATUS_FIRST]: {
    title: '执行反馈',
    hintText:
      '执行成功分两种情况：绿色表示申报调整策略基于最新的功率预测结果进行；黄色表示申报调整策略基于次新的功率预测结果进行。',
  },
  [ITitleType.ADJUST_POLICY_EDITING]: {
    title: '调整策略编辑',
  },
  [ITitleType.POWER_PREDICTION_AND_ADJUSTMENT_SIMULATION]: {
    title: '功率预测及调整模拟',
    instructionText: '功率预测滚动更新，比例申报调整会依据申报时最新预测进行，本数据仅做参考测算',
  },
  [ITitleType.CURRENTSTRATEGY]: {
    title: '风险增量(元)',
    hintText:
      '风险是指当市场预测在正常范围波动时，策略可能产生的最大亏损额。同等条件下，风险还受策略制定提前时间有关，越接近标的日，市场预测越准确，风险也相应越小。',
  },
  [ITitleType.AISTRATEGY]: {
    title: '风险增量(元)',
    hintText:
      '风险是指当市场预测在正常范围波动时，策略可能产生的最大亏损额。同等条件下，风险还受策略制定提前时间有关，越接近标的日，市场预测越准确，风险也相应越小。',
  },
  [ITitleType.STATUS_SECOND]: {
    title: '申报校验',
    hintText:
      '对“发送至主站数据”与“主站上送调度数据”进行比对校验，一致为成功，否则为失败。部分场站由于规则原因无法进行该项比对，则显示为“-”',
  },
  [ITitleType.STATUS_LAST]: {
    title: '出清校验',
    hintText:
      '对“发送至主站数据”与“交易中心披露出清数据”进行比对校验，一致为成功，否则为失败。注，由于出清原因不可控，本项比对设置一定容差',
  },
  [ITitleType.STATUS_EXECUTE]: {
    title: '执行状态',
    hintText:
      '执行状态分为四种情况：绿色表示执行成功；黄色表示部分执行成功；白色表示未进行调整；红色表示执行失败',
  },
};

export const strategyBenefitOptions: (ITitleType.AISTRATEGY | ITitleType.CURRENTSTRATEGY)[] = [
  ITitleType.CURRENTSTRATEGY,
  ITitleType.AISTRATEGY,
];

export const strategyBenefitTitleMap: any = {
  [ITitleType.CURRENTSTRATEGY]: {
    title: '当前策略',
    detailTitle: '当前策略详情',
    logo: iconAiNow,
  },
  [ITitleType.AISTRATEGY]: {
    title: 'AI策略',
    detailTitle: 'AI策略详情',
    logo: iconAi,
  },
};

export const executeStatusOptions: IOptionType[] = [
  { label: '未执行', value: IExecuteStatusType.NON_EXECUTION },
  { label: '已执行', value: IExecuteStatusType.EXECUTED },
];

export const statusFirstSelOptions: IOptionType[] = [
  { label: '执行成功', value: IStatusFirstType.SUCCESS_ONE },
  { label: '执行失败', value: IStatusFirstType.FAIL },
  { label: '-', value: IStatusFirstType.NONE },
];

export const statusLastSelOptions: IOptionType[] = [
  { label: '出清成功', value: IStatusLastType.CHECK_SUCCESS },
  { label: '出清失败', value: IStatusLastType.CHECK_FAIL },
  { label: '-', value: IStatusLastType.NOT_CHECK },
];

export const statusSecondSelOptions: IOptionType[] = [
  { label: '申报成功', value: IStatusSecondType.SUCCESS },
  { label: '申报失败', value: IStatusSecondType.FAIL },
  { label: '-', value: IStatusSecondType.NONE },
];
export const new_ExecuteStatusOptions: IExecuteStatusOptionType[] = [
  { label: '未执行', value: IExecuteStatusType.NON_EXECUTION, class: '', detail: false },
  { label: '已执行', value: IExecuteStatusType.EXECUTED, class: '', detail: false },
  {
    label: '成功',
    class: 'success',
    value: IExecuteStatusType.SUCCESS,
    detail: false,
  },
  {
    label: '成功',
    value: IExecuteStatusType.PARTIALSUCCESS,
    class: 'partialSuccess',
    detail: true, //部分成功
  },
  {
    label: '无调整',
    value: IExecuteStatusType.UNADJUSTED,
    class: 'unadjusted',
    detail: true,
  },
  {
    label: '失败',
    value: IExecuteStatusType.DATEERROR,
    class: 'error',
    detail: true, //日期错误
  },
  {
    label: '失败',
    value: IExecuteStatusType.ERROR,
    class: 'error',
    detail: true,
  },
  { label: '已调整', value: IExecuteStatusType.ADJUSTED, class: 'partialSuccess', detail: true },
];
export const statusFirstOptions: IStatusFirstOptionType[] = [
  {
    label: '成功',
    value: IStatusFirstType.SUCCESS_ONE,
    color: '#30D485',
    logoType: ILogoType.CHECKCIRCLEOUTLINED,
    class: 'success',
  },
  {
    label: '成功',
    value: IStatusFirstType.SUCCESS_TWO,
    color: '#FF9F0A',
    logoType: ILogoType.CHECKCIRCLEOUTLINED,
    class: 'partialSuccess',
  },
  {
    label: '失败',
    value: IStatusFirstType.FAIL,
    color: '#FD4F43',
    logoType: ILogoType.CLOSECIRCLEOUTLINED,
    class: 'error',
  },
];

export const statusSecondOptions: IStatusFirstOptionType[] = [
  {
    label: '成功',
    value: IStatusSecondType.SUCCESS,
    color: '#30D485',
    logoType: ILogoType.CHECKCIRCLEOUTLINED,
    class: 'success',
  },
  {
    label: '失败',
    value: IStatusSecondType.FAIL,
    color: '#FD4F43',
    logoType: ILogoType.CLOSECIRCLEOUTLINED,
    class: 'error',
  },
  {
    label: '-',
    value: IStatusSecondType.NONE,
    class: '',
  },
];

export const statusLastOptions: IStatusFirstOptionType[] = [
  {
    label: '成功',
    value: IStatusLastType.CHECK_SUCCESS,
    color: '#30D485',
    logoType: ILogoType.CHECKCIRCLEOUTLINED,
    class: 'success',
  },
  {
    label: '失败',
    value: IStatusLastType.CHECK_FAIL,
    color: '#FD4F43',
    logoType: ILogoType.CLOSECIRCLEOUTLINED,
    class: 'error',
  },
  {
    label: '-',
    value: IStatusLastType.NOT_CHECK,
    class: '',
  },
];

export const declareDetailDataChannelOptions: IOptionType[] = [
  { label: '功率 MW', value: IUnitType.POWER_UNIT },
  { label: '电量 MWh', value: IUnitType.ELECTRICITY_UNIT },
];
export const declareDetailDataChannelUnitOptions: IOptionType[] = [
  { label: 'MW', value: IUnitType.POWER_UNIT },
  { label: 'MWh', value: IUnitType.ELECTRICITY_UNIT },
];

export const smoothStatusOptions: IOptionType[] = [
  { label: '不平滑', value: ISmoothStatusType.NONE },
  { label: 'MODEL1', value: ISmoothStatusType.KALMAN },
  { label: 'MODEL2', value: ISmoothStatusType.BEZIER },
];

export const baseValueOptions: IOptionType[] = [
  { label: '无基数', value: IBaseValueType.NO_BASE },
  { label: '有基数', value: IBaseValueType.BASE },
];

export const correctionOptions: IOptionType[] = [
  { label: '修正前', value: ICorrectionType.BEFORE },
  { label: '修正后', value: ICorrectionType.AFTER },
];

export const sourceOptions: IOptionType[] = [
  { label: '历史统计', value: ISourceType.HISTORY },
  { label: '天机预测', value: ISourceType.TIAN_JI },
];
export const sourceDefaultOptions: IOptionType[] = [
  // { label: '天机预测', value: ISourceType.TIAN_JI },
  { label: '历史统计', value: ISourceType.HISTORY },
];
export const sourceDefaultSDOptions: IOptionType[] = [
  { label: '天机预测', value: ISourceType.TIAN_JI },
  // { label: '历史统计', value: ISourceType.HISTORY },
];

export const valueOptions: IOptionType[] = [
  { label: '均值', value: IValueType.MEAN_VALUE },
  { label: '最小值', value: IValueType.MIN_NUM },
  { label: 'Q1', value: IValueType.Q1 },
  { label: '中位数', value: IValueType.MEDIAN },
  { label: 'Q3', value: IValueType.Q3 },
  { label: '最大值', value: IValueType.MAX_NUM },
];

export const storeOptions: IOptionType[] = [
  { label: '考虑储能', value: IStoreType.CONSIDER },
  { label: '不考虑储能', value: IStoreType.NO_CONSIDER },
];

export const defaultPointerNum = 96;

export const columnsKeysList: IColumnsKeysList[] = [
  {
    code: IColumnsKeyType.TIME_ORDER,
    name: '时点',
  },
  {
    code: IColumnsKeyType.SIM_ADJUSTMENT,
    name: '发电量拟调整',
    persion: 3,
    hintText: '调节后-调节前',
  },
  {
    code: IColumnsKeyType.PRICE_DIFFF_ORECAST,
    name: '价差预估',
    persion: 2,
    hintText: '实时价格-日前价格',
  },
  {
    code: IColumnsKeyType.PRICE_DIFF_BELIEVE,
    name: '价差置信度',
    persion: 0,
  },
  {
    code: IColumnsKeyType.EARNINGS,
    name: '收益变动预估',
    persion: 2,
  },
  {
    code: IColumnsKeyType.RISK,
    name: '调整风险',
    persion: 2,
  },
];

/* export const forecastAndSimulateChartsLineTypeOptions: any = {
  [IForecastAndSimulateChartsLineType.LINE_ONE]: {
    name: '调整比例',
    color: '#F4903D',
  },
  [IForecastAndSimulateChartsLineType.LINE_THREE]: {
    name: '交易单元预测出力模拟调整结果',
    color: '#F4903D',
  },
  [IForecastAndSimulateChartsLineType.LINE_FOUR]: {
    name: '基数',
    color: '#494949',
  },
  [IForecastAndSimulateChartsLineType.LINE_FIVE]: {
    name: '市场化中长期',
    color: '#4A5A66',
  },
}; */

export const forecastAndSimulateChartsLineTypeOptions: any = {
  [IForecastAndSimulateChartsLineType.LINE_ONE]: {
    name: '调整比例',
    color: '#F4903D',
  },
  [IForecastAndSimulateChartsLineType.LINE_FIVE]: {
    name: '市场化中长期',
    color: '#4A5A66',
  },
  [IForecastAndSimulateChartsLineType.LINE_TWO]: {
    name: '交易单元出力预测结果',
    color: '#3B72F6',
  },
};

export const userAndSimulateChartsLineTypeOptions: any = {
  /* 
  交易单元出力预测结果
  手动策略调整结果-策略简称
  手动策略调整平滑结果-策略简称
  调整比例
  */
  [IUserAndSimulateChartsLineType.LINE_ONE]: {
    name: '调整比例',
    color: '#F4903D',
  },
};

export const priceDiffCurveChartsLineTypeOptions: IChartsLineType[] = [
  {
    code: IPriceDiffCurveChartsLineType.LINE_FIVE,
    name: '基数比例预测',
    persion: 0,
    color: '#67DCAB',
    type: IBaseValueType.BASE,
  },
  {
    code: IPriceDiffCurveChartsLineType.LINE_SIX,
    name: '现货日前价预测',
    persion: 2,
    color: '#5E92F6',
    type: IBaseValueType.BASE,
  },
  {
    code: IPriceDiffCurveChartsLineType.LINE_ONE,
    name: '现货日前价预测',
    color: '#5E92F6',
    persion: 2,
    type: IBaseValueType.NO_BASE,
  },
  {
    code: IPriceDiffCurveChartsLineType.LINE_TWO,
    name: '现货实时价预测',
    color: '#E86452',
    persion: 2,
  },
  {
    code: IPriceDiffCurveChartsLineType.LINE_THREE,
    name: '现货实时日前价差',
    color: '#F5BE15',
    persion: 2,
    type: IBaseValueType.NO_BASE,
  },
  {
    code: IPriceDiffCurveChartsLineType.LINE_SEVEN,
    name: '现货实时日前价差',
    color: '#F5BE15',
    persion: 2,
    type: IBaseValueType.BASE,
  },
  {
    code: IPriceDiffCurveChartsLineType.LINE_FOUR,
    name: '价差置信度',
    color: '#434E62',
    persion: 0,
  },
];

export const sideOptions: IOptionType[] = [
  { label: '结算端', value: ISideType.SETTLE },
  { label: '发电端', value: ISideType.GENERATE },
];

export const defaultSourceTypeSpecial = [
  '14', // 山西
  '37', // 山东
];

export const sourceTypeSpecialProvinceIds = [
  '14', // 山西
  '37', // 山东
];

export const img_info =
  '';

export const columns = [
  {
    name: '开始出力(MW)',
    align: 'left',
    code: 'startOutput',
  },
  {
    name: '结束出力(MW)',
    align: 'left',
    code: 'endOutput',
  },
  {
    name: '电价(元/MWh)',
    align: 'left',
    code: 'electricityPrice',
  },
  {
    name: '价格上限',
    align: 'left',
    code: 'upperLimitPrice',
  },
  {
    name: '价格下限',
    align: 'left',
    code: 'lowerLimitPrice',
  },
  {
    code: 'operation',
    name: '操作',
    width: 80,
    align: 'center',
  },
];
